package Java_teat_3;


import java.util.Scanner;

public class Company_test {
    public static void main(String[] args) {
        Conpany co=new Conpany("香岛","临泉路888号","8888888","烘焙原料");
        Scanner in=new Scanner(System.in);
        while (true){
            System.out.println("招聘员工请按1");
            System.out.println("输出员工信息请按2");
            System.out.println("辞退员工请按3");
            System.out.println("统计公司人数请按4");
            System.out.println("查找薪水最高的员工请按5");
            System.out.println("薪水从高到低排序请按6");
            System.out.println("退出请按9");
            System.out.println("请输入你的选择");
            switch (in.nextInt()){
                case 1:
                    System.out.println("请输入姓名,年龄，性别，职位，薪水");
                 Yuangong yuangong=new Yuangong(in.next(),in.nextInt(),in.next(),in.next(),in.nextDouble());
                 boolean b=co.addName(yuangong);
                 if (b==true){
                     System.out.println("添加成功");
                 }else{
                     System.out.println("添加失败");
                 }
                 break;
                case 2:
                    co.showXx();
                    break;
                case 3:
                    System.out.println("请输入要辞退的员工姓名");
                    String name=in.next();
                    boolean b1=co.expel(name);
                    if (b1==true){
                        System.out.println("删除成功");
                    }else{
                        System.out.println("删除失败");
                    }
                    break;
                case 4:
                    int count=co.renshu();
                    System.out.println("公司一共有"+count+"名员工");
                    break;
                case 5:
                 Yuangong maxxingshui=co.findTopSalary();
                 if (maxxingshui!=null){
                     System.out.println("薪水最高的员工是"+maxxingshui.name+"他的薪水是"+maxxingshui.xinshui);
                 }else{
                     System.out.println("没有这个员工");
                 }
                 break;
                case 6:
                    co.sortBySalDesc();
                    break;
                case 9:
                    return;
                    default:
                        System.out.println("你输入的选项不存在，请重新输入");
            }
        }
    }
}
